package com.jiangjiang.eshop.order.price.v1.calculator.impl;

import com.jiangjiang.eshop.order.dto.OrderItemDTO;
import com.jiangjiang.eshop.order.price.v1.calculator.TotalPriceCalculator;
import org.springframework.stereotype.Component;

/**
 * @Author Jianghaowen
 * @Date 2021/7/14
 * @Description: 总金额默认计算
 * @Version V1.0
 **/
@Component
public class DefaultTotalPriceCalculator implements TotalPriceCalculator {
    /**
     * 默认订单条目金额计算
     * @param itemDTO 订单条目
     * @return 订单条目金额
     */
    @Override
    public Double calculate(OrderItemDTO itemDTO) {
        return itemDTO.getPurchasePrice() * itemDTO.getPurchaseQuantity();
    }
}
